package com.pansoft.openplanet.account.model;

import org.web3j.crypto.ECKeyPair;
import org.web3j.crypto.WalletFile;

import java.io.Serializable;
import java.util.List;

//eth钱包账户相关
public class EthBean implements Serializable {

    //地址
    private String ethAddress;

    private ECKeyPair ecKeyPair;
    //助记词
    private List<String> mnemonicList;
    //空格分割的助记词
    private String  mnemonic;
    private WalletFile walletFile;
    //keystore 文件路径
    private String keyStoreFilePath;

    //类型 0 表示以前的方式生成的  1 表示 hd方式生成的
    private int type;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public EthBean() {
    }

    private EthBean(Builder builder) {
        setEthAddress(builder.ethAddress);
        setEcKeyPair(builder.ecKeyPair);
        setMnemonicList(builder.mnemonicList);
        setMnemonic(builder.mnemonic);
        setWalletFile(builder.walletFile);
        setKeyStoreFilePath(builder.keyStoreFilePath);
        setType(builder.type);

    }

    public String getEthAddress() {
        return ethAddress;
    }

    public EthBean setEthAddress(String ethAddress) {
        this.ethAddress = ethAddress;
        return this;
    }

    public ECKeyPair getEcKeyPair() {
        return ecKeyPair;
    }

    public EthBean setEcKeyPair(ECKeyPair ecKeyPair) {
        this.ecKeyPair = ecKeyPair;
        return this;
    }

    public List<String> getMnemonicList() {
        return mnemonicList;
    }

    public EthBean setMnemonicList(List<String> mnemonicList) {
        this.mnemonicList = mnemonicList;
        return this;
    }

    public String getMnemonic() {
        return mnemonic;
    }

    public EthBean setMnemonic(String mnemonic) {
        this.mnemonic = mnemonic;
        return this;
    }

    public WalletFile getWalletFile() {
        return walletFile;
    }

    public EthBean setWalletFile(WalletFile walletFile) {
        this.walletFile = walletFile;
        return this;
    }

    public String getKeyStoreFilePath() {
        return keyStoreFilePath;
    }

    public EthBean setKeyStoreFilePath(String keyStoreFilePath) {
        this.keyStoreFilePath = keyStoreFilePath;
        return this;
    }


    public static final class Builder {
        private String ethAddress;
        private ECKeyPair ecKeyPair;
        private List<String> mnemonicList;
        private String mnemonic;
        private WalletFile walletFile;
        private String keyStoreFilePath;
        private int type;

        public Builder() {
        }

        public Builder ethAddress(String val) {
            ethAddress = val;
            return this;
        }
        public Builder type(int type) {
            this.type = type;
            return this;
        }
        public Builder ecKeyPair(ECKeyPair val) {
            ecKeyPair = val;
            return this;
        }

        public Builder mnemonicList(List<String> val) {
            mnemonicList = val;
            return this;
        }

        public Builder mnemonic(String val) {
            mnemonic = val;
            return this;
        }

        public Builder walletFile(WalletFile val) {
            walletFile = val;
            return this;
        }

        public Builder keyStoreFilePath(String val) {
            keyStoreFilePath = val;
            return this;
        }

        public EthBean build() {
            return new EthBean(this);
        }
    }
}
